package com.anhuanjia.tools.eao.util;

import java.util.HashMap;
import java.util.Map;

public class ProcedureUtils {

	
	public static final Integer BTN_SAVE = 1;//保存
	public static final Integer BTN_SUBMIT = 2;//提交
	
	final private String procedure1 = "创建项目";
	final private String procedure2 = "资料收集";
	final private String procedure3 = "现场踏勘";
	final private String procedure4 = "环境质量及检测";
	final private String procedure5 = "报告编制及审核";
	final private String procedure6 = "分公司一审";
	final private String procedure7 = "分公司二审";
	final private String procedure8 = "初审";
	final private String procedure9 = "复审";
	final private String procedure10 = "终审";
	final private String procedure11 = "报告送审";
	final private String procedure12 = "技术评估";
	final private String procedure13 = "报告报批";
	final private String procedure14 = "报告公示";
	final private String procedure15 = "报告存档";

	public static String projectType(Integer type){
		
		Map<Integer,String> map = new HashMap<Integer,String>();
		map.put(1, "创建项目");
		map.put(2, "资料收集");
		map.put(3, "现场踏勘");
		map.put(4, "环境质量及检测");
		map.put(5, "报告编制及审核");
		map.put(6, "分公司一审");
		map.put(7, "分公司二审");
		map.put(8, "初审");
		map.put(9, "复审");
		map.put(10, "终审");
		map.put(11, "报告送审");
		map.put(12, "技术评估");
		map.put(13, "报告报批");
		map.put(14, "报告公示");
		map.put(15, "报告存档");
		map.put(16, "已入库");
		for (Map.Entry<Integer, String> m : map.entrySet()) {
		    if(type==m.getKey()){
		    	return m.getValue();
		    }  
		}
		return "";
	}
	
	
	public Boolean procedure(String oldProcedure, String newProcedure) {
// 		procedure1 < procedure2 < procedure3 < procedure4 < procedure5 < procedure6 < procedure7 < procedure8 < procedure9 < procedure10;
		Map<Integer, String> map = new HashMap<Integer, String>();
		map.put(1, procedure1);
		map.put(2, procedure2);
		map.put(3, procedure3);
		map.put(4, procedure4);
		map.put(5, procedure5);
		map.put(6, procedure6);
		map.put(7, procedure7);
		map.put(8, procedure8);
		map.put(9, procedure9);
		map.put(10, procedure10);
		map.put(11, procedure11);
		map.put(12, procedure12);
		map.put(13, procedure13);
		map.put(14, procedure14);
		map.put(15, procedure15);
		int oldin = 0;
		int newin = 0;
		for (Integer in : map.keySet()) {
			// map.keySet()返回的是所有key的值
			String str = map.get(in);// 得到每个key多对用value的值
			System.out.println(in + "     " + str);
			if (oldProcedure.equals(str)) {
				oldin = in;
			}
			if (newProcedure.equals(str)) {
				newin = in;
			}
		}
		if (oldin - newin >= 0) {
			return true;
		} else {
			return false;
		}
	}
	
	public static void main(String[] args) {
		ProcedureUtils p = new ProcedureUtils();
		Boolean b = p.procedure("报告编制及审核" , "资料收集");
		if(b) {
			System.out.println("报告编制及审核");
		}else {
			System.out.println("复审");
		}
	}

}
